package com.baomidou.springwind.test.IO;

import java.io.*;

/**
 * Created by Administrator on 2017/3/12.
 */

class Blips1 implements Externalizable{
    public Blips1() {
        System.out.println("Blips1's Constructor ");
    }
    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
        System.out.println("Blips1's writeExternal");
    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        System.out.println("Blips1's readExternal");
    }
}class Blips2 implements Externalizable{
    public Blips2() {
        System.out.println("Blips2's Constructor ");
    }
    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
        System.out.println("Blips2's writeExternal");
    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        System.out.println("Blips2's readExternal");
    }
}

public class Blips {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        Blips1 b1 = new Blips1();
        Blips2 b2 = new Blips2();
        ObjectOutputStream o =
                new ObjectOutputStream(
                        new FileOutputStream("F:\\code\\SpringWind\\SpringWind\\src\\main\\java\\com\\baomidou\\springwind\\test\\IO\\Blips.out"));
        o.writeObject(b1);
        o.writeObject(b2);
        o.close();

        ObjectInputStream ois =
                new ObjectInputStream(
                        new FileInputStream("F:\\code\\SpringWind\\SpringWind\\src\\main\\java\\com\\baomidou\\springwind\\test\\IO\\Blips.out"));
        Blips1 rb1 = (Blips1) ois.readObject();
        System.out.println(rb1);

        Blips2 rb2 = (Blips2) ois.readObject();
        System.out.println(rb2);

    }
}
